package homework;

import java.util.concurrent.LinkedBlockingDeque;

public class Demo12 {
    public static void main(String[] args) throws InterruptedException {
        LinkedBlockingDeque<String> queue = new LinkedBlockingDeque<String>(10);
        Thread t = new Thread() {
            public void run() {
                try {
                    System.out.println("开始消费数据");
                    String s = queue.take();
                    System.out.println(s);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        };
        t.start();
        Thread.sleep(5000);
        System.out.println("生产数据");
        queue.put("1000");
    }
}
